<?php
class Lion_View_Helper_Mailer extends Zend_Controller_Action_Helper_Abstract
{
    public function mailer ($to_address, $to_name, $subject, $message)
    {
        //$curr_lang = $sess->current_lang;
        Zend_Loader::loadFile('/phpmailer/class.phpmailer.php');
        
        $message_footer = "<img src='http://" . $_SERVER['SERVER_NAME'] . "/images/shared/pristine.jpg' />";
        
        $message_body = $message . "<br /><br />" . $message_footer;
        
        $mail = new PHPMailer(true);
		
		
		$mail->IsSMTP(); // telling the class to use SMTP

		try {
		  $mail->Host       = "smtpout.secureserver.net"; // SMTP server
		  $mail->SMTPDebug  = 1;                     // enables SMTP debug information (for testing)
		  $mail->SMTPAuth   = true;                  // enable SMTP authentication
		  $mail->Port       = 25;                    // set the SMTP port for the GMAIL server
		  $mail->Username   = "anuradha@pristineworldwide.com"; // SMTP account username
		  $mail->Password   = "anu123!@#";        // SMTP account password
		  //$mail->AddReplyTo('inquiry@pristineworldwide.com', 'First Last');
		  $mail->AddAddress($to_address, $to_name);
		  $mail->SetFrom('info@pristineworldwide.com', 'Pristine Discussions');
		  $mail->Subject = $subject;
		  $mail->MsgHTML($message_body);
		  //$mail->AddAttachment('images/shared/pristine.jpg'); // attachment
		  $mail->Send();
		  //echo "Message Sent OK</p>\n";
		} catch (phpmailerException $e) {
		  echo $e->errorMessage(); //Pretty error messages from PHPMailer
		} catch (Exception $e) {
		  echo $e->getMessage(); //Boring error messages from anything else!
		}
    }   
}
